import React, { Component } from 'react';

class Index extends Component {
  render() {
    const { list, activeIndex, handleChangeIndex } = this.props
    return (
      <div className="title">
        {
          list.length > 0 && list.map((item, i) => {
            return (
              <b key={item.id} 
                onClick={ () => handleChangeIndex(i) }
                className={ activeIndex ===i ? 'active': '' }
             >{item.title}</b>
            )
          })
        }
      </div>
    );
  }
}

export default Index;
